from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client import Client
from django.core import mail

class FeedbackTest(TestCase):
    
    def setUp(self):
        self.client = Client()
            
    def test_feedback(self):
        response = self.client.get(reverse('feedback'))
        self.assertEquals(response.status_code, 200)
     
    def test_feedback_successful(self):
        response = self.client.get(reverse('feedback'))
        self.assertEquals(response.status_code, 200)

        response = self.client.post(reverse('feedback'), {
           'first_name': 'Joe',
           'surname': 'Bloggs',
           'email': 'test@example.org',
           'comment':  'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus non feugiat nunc. Nunc mollis nunc vitae odio semper nec porttitor felis convallis.'})
         
        self.assertEquals(len(mail.outbox), 1)
        self.assertEquals(mail.outbox[0].subject, 'StudentHoods: Feedback')
        self.assertEquals(response.status_code, 302)        
        